﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using GalaSoft.MvvmLight;

namespace BankCharts.Silverlight.ViewModel.Models
{
    /// <summary>
    /// This class contains all data representing a bank statement
    /// at each step of the transformation
    /// </summary>
    public class BankLine : ViewModelBase
    {

        #region NotParsedBankLine
        private string _NotParsedBankLine = string.Empty;

        /// <summary>
        /// Gets the NotParsedBankLine property.
        /// This property represent the free text before splitting
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public string NotParsedBankLine
        {
            get
            {
                return _NotParsedBankLine;
            }

            set
            {
                if (_NotParsedBankLine == value)
                {
                    return;
                }

                _NotParsedBankLine = value;

                // Update bindings, no broadcast
                RaisePropertyChanged("NotParsedBankLine");
            }
        }
        #endregion

        #region SplitedColumn
        private string[] _SplitedColumn = null;

        /// <summary>
        /// Gets the SplitedColumn property.
        /// Once splitted, this property will store the result before parsing
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public string[] SplitedColumn
        {
            get
            {
                return _SplitedColumn;
            }

            set
            {
                if (_SplitedColumn == value)
                {
                    return;
                }

                _SplitedColumn = value;

                // Update bindings, no broadcast
                RaisePropertyChanged("SplitedColumn");
            }
        }
        #endregion

        #region Date
        private DateTime _Date = DateTime.MinValue;

        /// <summary>
        /// Gets the Date property.
        /// Contains the transaction date.
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public DateTime Date
        {
            get
            {
                return _Date;
            }

            set
            {
                if (_Date == value)
                {
                    return;
                }

                _Date = value;

                // Update bindings, no broadcast
                RaisePropertyChanged("Date");
            }
        }
        #endregion

        #region Text
        private string _Text = string.Empty;

        /// <summary>
        /// Gets the Text property.
        /// Contains the summary text of the statement.
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public string Text
        {
            get
            {
                return _Text;
            }

            set
            {
                if (_Text == value)
                {
                    return;
                }

                _Text = value;

                // Update bindings, no broadcast
                RaisePropertyChanged("Text");
            }
        }
        #endregion

        #region Value
        private float _Value = 0;

        /// <summary>
        /// Gets the Value property.
        /// The value of the statement, once parsed.
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public float Value
        {
            get
            {
                return _Value;
            }

            set
            {
                if (_Value == value)
                {
                    return;
                }

                _Value = value;

                // Update bindings, no broadcast
                RaisePropertyChanged("Value");
            }
        }
        #endregion

        #region IsValid
        private bool _IsValid = false;

        /// <summary>
        /// Gets the IsValid property.
        /// The property contains the result of the parsing.
        /// Is it good ?
        /// Changes to that property's value raise the PropertyChanged event. 
        /// This property's value is broadcasted by the Messenger's default instance when it changes.
        /// </summary>
        public bool IsValid
        {
            get
            {
                return _IsValid;
            }

            set
            {
                if (_IsValid == value)
                {
                    return;
                }

                _IsValid = value;

                // Update bindings, no broadcast
                RaisePropertyChanged("IsValid");
            }
        }
        #endregion
    }
}
